import { ActivatedRoute, Params } from '@angular/router';
import { Injectable } from '@angular/core';
import { Headers, Http, Response } from '@angular/http';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/toPromise';


@Injectable()
export class TreeService {

    private headers = new Headers({ 'Content-Type': 'application/json' });

    constructor(private http: Http) { }

    private _url = 'app/tree';

    getTreeData(url: string) {
        // return this.http.get(url)
        //     .toPromise()
        //     .then(res => res.json().data as any[])
        //     .then(data => { return data });
        return Function;
    }

    private handleError(error: any): Promise<any> {
        console.log('An error occurred', error); // for demo purposes only
        return Promise.reject(error.message || error);
    }
}